package com.hp.service;

import com.hp.annocatation.RedisLock;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.concurrent.TimeUnit;

/**
 * @author hp
 */
@Service
@Slf4j
public class RedLockService {

    @RedisLock
    public void buyGoods() {


        System.out.println("业务逻辑---开始");
        try {
            TimeUnit.SECONDS.sleep(10);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("业务逻辑---结束");


    }
}